Buying a Domain Name for your personal website 个人网站购买域名

Basically, it takes 2 steps to bind your personal website/blog to a Domain Name:

Understading the Theory!

IP Address is the machine(server) that hosts(runs) your website. If you use Github Pages, Vercel, etc. Your website is hosted on their server.
DNS服务将域名解析至IP地址。

购买域名

Buy a Domain Name From a Domain Registrar(域名注册商), 这里选用了NameSilo,续费不涨价,且续费每年35即可。

References

设置DNS服务

Configure the Domain Parsing, so that DNS Servers can redirect those visiting your domain name to your IP address. 这里我们没有使用NameSilo自带的DNS服务,而是改为使用Cloudfare的DNS服务,具体过程参考:Namesilo/Cloudflare域名注册和解析设置教程 blog

为了将Vercel或Github Pages托管的个人网站绑定的购买的域名(Apex Domain)或子域名(subdomain)上,需要分别在DNS服务提供商和网站托管商处进行设置,具体可参考

子域名可以是二级、三级、四级...任意多级的子域名
NameSilo允许创建最多50个子域名

Cloudfare踩坑记

Vercel/Github使用Cloudfare DNS均遇到了问题。

Cloudfare:有时候,功能太强大反而是种累赘。

Github Pages

在Github Pages中,尝试添加Cloudfare上设置的Custom Domain,虽然添加成功,但无法在Enforce HTTPS前的勾选框上打勾,参考了Github这个回答解决了我的问题:针对Cloudfare用户,需要关闭Cloudfare的Proxy来解决。

配置正确之后,点击save,Github会自动发起TLS 证书验证流程。流程通过后,即可勾选Enforce HTTPs选项。
Pasted image 20240113205253.png

Vercel

Vercel的坑就更多了。始终显示err_too_many_redirects重定向次数过多。

参考了,使用了前两篇的做法:向GIthub Pages的处理方法一样,关掉Proxy;再将SSL/TLS调为Full(strict),才能顺利访问。